/*
 * 组件注释
 * @Author: machinist_wq
 * @Date: 2022-09-02 22:29:52
 * @LastEditors: machinist_wq
 * @LastEditTime: 2022-09-07 14:06:42
 * @Description: 抽取表格组件做公共配置
 * 人生无常！大肠包小肠......
 */
"use strict";
import { FC, ReactElement } from "react";
import { Table } from "antd";
import type { ColumnsType, TableProps } from "antd/es/table";
import noData from "@/assets/images/noData.png";

interface DataType {
  (x: string): unknown;
}

interface IProps {
  columns: ColumnsType<DataType>;
  searchValues: unknown;
}
const Index: FC<IProps & TableProps<any>> = (
  props: IProps & TableProps<any>
): ReactElement => {
  const { columns, searchValues, ...others } = props;

  return (
    <Table
      size={"small"}
      className={"commonTable"}
      columns={columns}
      locale={{
        emptyText: !others?.loading ? (
          <div className={"no_data_box"} style={{ padding: "70px 0" }}>
            <img style={{ width: 282 }} src={noData} alt="" />
            <p>
              {window.isEmpty(searchValues) ? "暂无相关内容" : "暂无搜索内容"}
            </p>
          </div>
        ) : (
          <div style={{ padding: "150px 0" }} />
        ),
      }}
      {...others}
    />
  );
};
export default Index;
